<template>
	<view class="refund">
		<view class="refund_shop">
			<view class="refund_shop_title">
				<view class="">退款商品</view>
			</view>
			<view class="refund_shop_info">
				<image :src="util.imageApi+ShopList.goodsImg" mode=""></image>
				<view class="goodsName">
					<view>{{ShopList.goodsName}}</view>
					<view class="goods_num">x{{ShopList.num}}</view>
				</view>
			</view>
		</view>
		<view class="refund_shop">
			<view class="refund_shop_title">
				退款信息
			</view>
			<view class="info_huwu">
				<view class="info_huwu_title">
					退款原因
				</view>
				<view class="info_huwu_cli" @click="XZPoup()" v-if="title == ''">
					请选择<uni-icons color="#dedede" type="right"></uni-icons>
				</view>
				<view class="info_huwu_cli2" @click="XZPoup()" v-else>
					{{title}}
				</view>
			</view>
			<view class="info_huwu">
				<view class="info_huwu_title">
					退款金额
				</view>
				<view class="info_huwu_price">
					￥{{ShopList.price}}
				</view>
			</view>
		</view>
		<view class="refund_shop">
			<view class="refund_shop_title">
				补充描述
			</view>
			<u--textarea v-model="value1" placeholder="请输入补充描述"></u--textarea>
		</view>
		<u-button shape="circle" @click="Tj()" text="提交" type="success"></u-button>
		<u-popup :round="10" :show="show" @close="close" @open="open" v-if="dia">
			<view class="poput">
				<u-radio-group v-model="radiovalue1" placement="column">
					<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist1" :key="index"
						:label="item.label" :name="item.index" @change="radioChange(item)">
					</u-radio>
				</u-radio-group>
			</view>
		</u-popup>
	</view>
</template>

<script>
		import util from "@/util/index.js"
	export default {
		data() {
			return {
				util:util,
				dia: true,
				price: '',
				orderNo: '',
				value1: '',
				radiovalue1: '',
				show: false,
				radiolist1: [{
					label: '收到商品破损',
					index: 1
				}, {
					label: '商品错发、漏发',
					index: 2
				}, {
					label: '收到商品与描述不符',
					index: 3
				}, {
					label: '商品质量问题',
					index: 4
				}, {
					label: '未按照约定时间发货',
					index: 5
				}, {
					label: '买错了',
					index: 6
				}],
				title: '',
				id: '',
				ShopList: {}
			}
		},
		methods: {
			Tj() {
				this.$http({
					url: "/crmOrderRefunds/applyReimburse",
					data: {
						orderNo: this.orderNo,
						refundCauseId: this.radiovalue1,
						backMoney: this.ShopList.price,
						id: this.id
						// backScore:''
					}
				}).then(res => {
					if (res.data.data == true) {
						uni.showToast({
							title: '提交成功'
						}).then(setTimeout(() => {
							uni.navigateBack({
								delta: 2
							})
						}, 1000))
					} else {
						uni.showToast({
							title: res.data.message,
							icon: 'error'
						})
					}
				})
			},
			radioChange(n) {
				this.title = n.label
				this.show = false
			},
			XZPoup() {
				this.show = true
			},
			close() {
				this.show = false
			},
			open() {
				this.show = true
			},
			SearchData() {
				this.$http({
					url: '/crmOrderRefunds/refundedGoods',
					data: {
						id: this.id
					}
				}).then(res => {
					this.ShopList = res.data.data
				})
			}
		},
		onLoad(option) {
			this.orderNo = option.orderNo
			this.id = option.id
			this.SearchData()
		}
	}
</script>

<style>
	.refund_shop_info {
		display: flex;
	}

	.goodsName {
		margin-top: 10rpx;
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		margin-left: 20rpx;
		font-size: 34rpx;
		font-weight: 600;
	}

	.goods_num {
		margin-top: 100rpx;
		font-size: 20px;
		font-weight: 500;
	}

	image {
		width: 50%;
		height: 19vh;
	}

	.u-button {
		width: 90%;
	}

	.refund {
		height: calc(100vh - 90rpx);
		background-color: #F8F8F8;
		overflow: hidden;
	}

	.refund_shop {
		background-color: white;
		width: 95%;
		height: 25vh;
		border-radius: 50px;
		margin: 40rpx auto;
		overflow: hidden;
	}

	.refund_shop_title {
		font-weight: 650;
		font-size: 35rpx;
		margin-left: 60rpx;
		margin-top: 40rpx;
	}

	.info_huwu {
		margin-top: 60rpx;
		margin-left: 60rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-right: 60rpx;
	}

	.info_huwu_price {
		color: red;
		font-weight: 600;
	}

	.info_huwu_cli {
		color: #dedede;
	}

	.info_huwu_cli2 {
		color: #000000;
	}

	.u-textarea {
		width: 90%;
		margin: 20rpx auto;
		background-color: #F8F8F8;
		border-radius: 40rpx;
		height: 50%;
	}

	.poput {
		height: 40vh;
	}

	.u-radio-group {
		margin-top: 20rpx;
		margin-left: 20rpx;
		display: flex;
		flex-direction: column;
	}

	.u-radio {
		margin-top: 40rpx;
	}
</style>
